﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using MarvinsArena.Core;


namespace BattleEngineCommon
{
	public class Hud
	{
        public HudMessages messages {get; set;}

        private HudStatusPanel statusPanel;
        private HudRadar radar;

        private SpriteFont normalFont;
        private SpriteFont smallFont;

        public Hud(int ScreenWidth)
        {
            this.messages = new HudMessages();
            this.statusPanel = new HudStatusPanel();
            this.radar = new HudRadar(ScreenWidth);
        }

        public void LoadContent(ContentManager Content)
        {
            //Loading fonts
            this.normalFont = Content.Load<SpriteFont>(@"Fonts/MenuFont");
            this.smallFont = Content.Load<SpriteFont>(@"Fonts/SmallFont");

            //Loading content for messages
            this.messages.Font = normalFont;
            this.messages.FontSmall = smallFont;

            //Loading content for status panel
            this.statusPanel.Texture = Content.Load<Texture2D>(@"Hud/StatusPanel");
            this.statusPanel.Font = normalFont;

            //Loading content for radar
            this.radar.Texture = Content.Load<Texture2D>(@"Hud/Radar");
        }

        public void Draw(SpriteBatch spriteBatch, IRobot robot, List<IRobot> robots, IMap map, TournamentRules rules)
        {
            //Drawing HUD messages
            this.messages.DrawMessages(spriteBatch);

            //if robot selected, drawing status panel and radar
            if (robot != null)
            {
                //Drawing HUD radar
                this.radar.Draw(spriteBatch, robot, robots, map);
                
                //Drawing status panel
                this.statusPanel.Draw(spriteBatch, robot, rules);
            }
        }
	}
}
